#pragma once
#include <iostream>
#include <vector>

class Planet
{
private:
    std::string name_;
    double mass_;
    double radius_;

public:
    Planet() : name_(""), mass_(0.0), radius_(0.0) {}
    Planet(const std::string &name, double mass, double radius);

    const std::string &getName() const;
    double getMass() const;
    double getRadius() const;

    friend std::ostream &operator<<(std::ostream &out, const Planet &planet);
    friend std::istream &operator>>(std::istream &in, Planet &planet);
};

class PlanetSystem
{
private:
    std::vector<Planet> planets_;

public:
    void addPlanet(const Planet &planet);
    void sortPlanetsByMass();
    void sortPlanetsByRadius();
    void printPlanets() const;
    void readPlanetsFromFile(const std::string &filename);
    void writePlanetsToFile(const std::string &filename) const;
};
